﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
using WLWeb.PulbicClass;

namespace WLWeb.Common
{
    public partial class QianYue : System.Web.UI.Page
    {
        string OtherCategoryID = "";
        BLL.wlBLL.Acticle art = new BLL.wlBLL.Acticle();
        protected void Page_Load(object sender, EventArgs e)
        {
            webleft1.Acticle = Webpublic.GetGroupName(3);
            webleft1.Title = "最新签约";
            InitDataShow();
        }

        protected void InitDataShow()
        {
            DataTable dtArtcle = new DataTable();
            if (Request.QueryString["OtherCategoryID"] != null && Request.QueryString["OtherCategoryID"].ToString() != "")
            {
                OtherCategoryID = Request.QueryString["OtherCategoryID"].ToString();
            }
            if (OtherCategoryID == "")
            {
                string group = Webpublic.GetGroupName(3);
                dtArtcle = art.GetActicleInfo(new Hashtable() { { "OtherCategoryGroup", group } });         //根据组别可查出给定组别的数据
            }
            else
            {
                dtArtcle = art.GetActicleInfo(new Hashtable() { { "OtherCategoryID", OtherCategoryID } });
            }
            if (dtArtcle != null && dtArtcle.Rows.Count > 0)
            {
                DataView dtshow = dtArtcle.DefaultView;                     //进行排序
                dtshow.Sort = " REC_CreateTime desc";
                repQianYueShow.DataSource = dtshow;
                repQianYueShow.DataBind();
            }
        }
        /// <summary>
        /// 根据时间判断是否显示New
        /// </summary>
        /// <param name="datetime"></param>
        /// <returns></returns>
        protected string IsAddnew(string datetime)      
        {
            if (datetime != null && datetime != "")
            {
                if (Convert.ToDateTime(datetime).AddDays(5) >= DateTime.Now)
                {
                    return "<font style=\"font-family: Arial; color: rgb(255, 0, 0);\">&nbsp;&nbsp;new</font>";
                }
            }
            return "<font style=\"font-family: Arial; color: rgb(255, 0, 0);\"></font>";
        }
        /// <summary>
        /// 判断项目状态
        /// </summary>
        /// <param name="endtime"></param>
        /// <returns></returns>
        protected string IsFinish(string endtime)
        {
            if (Convert.ToDateTime(endtime) > DateTime.Now)
            {
                return "制作中";
            }
            else
            {
                return "已完成";
            }
        }
    }
}